<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>条件渲染</title>
    <script src="./js/babel.min.js"></script>
    <script src="./js/react.development.js"></script>
    <script src="./js/react-dom.development.js"></script>
    <style>
      #banner{
        height: 100px;
        background: #c69;
      }
    </style>
  </head>
  <body>
    <div id="root"></div>
    <script type="text/babel">
      //是否为 VIP
      let isVip = false; 

      //声明变量
      let vdom;
      //1. if ....else...
      // if(!isVip){
      //   vdom = <div id="banner"></div>
      // }

      //2. 三元运算符
      // vdom = isVip ? null : <div id="banner"></div>

      //3. 逻辑与   &&      1 && 2   1 || 2
      vdom = !isVip && <div id="banner"></div> ;

      //渲染
      ReactDOM.render(vdom, document.querySelector('#root'));
    </script>
  </body>
</html>
